﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;

/// <summary>
/// Summary description for CTloaitu
/// </summary>
public class CTloaitu
{
	public CTloaitu()
	{
		//
		// TODO: Add constructor logic here
		//
	}
    ConnectionProcess cp = new ConnectionProcess();
    public void Them_ctloaitu(int matv,int matu,string anh,string phienam,string viet)
    {
        SqlParameter p1 = new SqlParameter("@matv", matv);
        SqlParameter p2 = new SqlParameter("@matu", matu);
        SqlParameter p3 = new SqlParameter("@nghiaanh", anh);
        SqlParameter p4 = new SqlParameter("@phienam", phienam);
        SqlParameter p5 = new SqlParameter("@nghiaviet",viet);
        cp.thuchienlenh("Them_ctloaitu", p1,p2,p3,p4,p5);
    }
    public DataTable Load_ctloaitu()
    {
        return cp.Get_data("Load_ctloaitu");
    }
    public DataTable Load_ngonngu(string type, string key)
    {
        DataTable dt = new DataTable();
        switch (type)
        {
            case "VE":
                dt = TypeVE(key);
                break;
            case "EV":
                dt = TypeEV(key);
                break;
           
        }
        return dt;
    }

    private DataTable TypeEV(string key)
    {
        SqlParameter p1 = new SqlParameter("@tu", key);
        return cp.Get_data("TypeEV", p1);
    }

    // Tim nhung bai hat co ten la key
    public DataTable TypeVE(string key)
    {
        SqlParameter p1 = new SqlParameter("@tu", key);
        return cp.Get_data("TypeVE", p1);
    }
}